package com.flurry.android;

import java.nio.ByteBuffer;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

final class ea
{
  private static String p = "FlurryAgent";
  private FlurryAds fI;

  ea(FlurryAds paramFlurryAds)
  {
    this.fI = paramFlurryAds;
  }

  private static boolean h(String paramString1, String paramString2)
  {
    return paramString2.equals("%{" + paramString1 + "}");
  }

  final String a(cw paramcw, AdUnit paramAdUnit, String paramString1, String paramString2)
  {
    String str1;
    if (h("fids", paramString2))
    {
      StringBuilder localStringBuilder = new StringBuilder();
      localStringBuilder.append(0).append(":").append(FlurryAds.getPhoneId());
      Map localMap = this.fI.bi();
      if (localMap != null)
      {
        Iterator localIterator1 = localMap.entrySet().iterator();
        while (localIterator1.hasNext())
        {
          Map.Entry localEntry1 = (Map.Entry)localIterator1.next();
          localStringBuilder.append(",").append(((ReportedIdType)localEntry1.getKey()).eS).append(":");
          if (((ReportedIdType)localEntry1.getKey()).eT)
            localStringBuilder.append(((ByteBuffer)localEntry1.getValue()).array());
          else
            localStringBuilder.append(fl.d(((ByteBuffer)localEntry1.getValue()).array()));
        }
      }
      cy.c(p, "Replacing param fids with: " + localStringBuilder.toString());
      str1 = paramString1.replace(paramString2, fl.D(localStringBuilder.toString()));
    }
    String str2;
    do
    {
      return str1;
      if (h("sid", paramString2))
      {
        String str9 = String.valueOf(this.fI.aJ());
        cy.c(p, "Replacing param sid with: " + str9);
        return paramString1.replace(paramString2, fl.D(str9));
      }
      if (h("lid", paramString2))
      {
        String str8 = String.valueOf(paramcw.getIndex());
        cy.c(p, "Replacing param lid with: " + str8);
        return paramString1.replace(paramString2, fl.D(str8));
      }
      if (h("guid", paramString2))
      {
        String str7 = paramcw.aA();
        cy.c(p, "Replacing param guid with: " + str7);
        return paramString1.replace(paramString2, fl.D(str7));
      }
      if (h("ats", paramString2))
      {
        String str6 = String.valueOf(System.currentTimeMillis());
        cy.c(p, "Replacing param ats with: " + str6);
        return paramString1.replace(paramString2, fl.D(str6));
      }
      if (h("apik", paramString2))
      {
        String str5 = FlurryAds.y();
        cy.c(p, "Replacing param apik with: " + str5);
        return paramString1.replace(paramString2, fl.D(str5));
      }
      if (h("hid", paramString2))
      {
        String str4 = paramAdUnit.getAdSpace().toString();
        cy.c(p, "Replacing param hid with: " + str4);
        return paramString1.replace(paramString2, fl.D(str4));
      }
      if (h("eso", paramString2))
      {
        String str3 = Long.toString(System.currentTimeMillis() - this.fI.aJ());
        cy.c(p, "Replacing param eso with: " + str3);
        return paramString1.replace(paramString2, fl.D(str3));
      }
      if (!h("uc", paramString2))
        break;
      Iterator localIterator2 = this.fI.bk().entrySet().iterator();
      Map.Entry localEntry2;
      for (str2 = ""; localIterator2.hasNext(); str2 = str2 + "c_" + fl.D((String)localEntry2.getKey()) + "=" + fl.D((String)localEntry2.getValue()) + "&")
        localEntry2 = (Map.Entry)localIterator2.next();
      cy.c(p, "Replacing param uc with: " + str2);
      str1 = paramString1.replace(paramString2, str2);
    }
    while ((!str2.equals("")) || (str1.length() <= 0));
    return str1.substring(0, -1 + str1.length());
    cy.c(p, "Unknown param: " + paramString2);
    return paramString1.replace(paramString2, "");
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.flurry.android.ea
 * JD-Core Version:    0.6.2
 */